﻿namespace DomainExample.Repository
{
    public sealed class RepositoryFactory : IRepositoryFactory
    {
        private RepositoryFactory()
        {
        }

        public static IRepositoryFactory NewRepositoryFactory()
        {
            return new RepositoryFactory();
        }

        public IContactRepository GetContactRepository()
        {
            return new ContactRepository(GetDataProvider());
        }

        public IPersonRepository GetPersonRepository()
        {
            return new PersonRepository(GetDataProvider());
        }

        private static SqlDataProvider GetDataProvider()
        {
            return new SqlDataProvider(new ConfigConnectionStringProvider());
        }
    }
}
